quaternion Interface

public interface quaternion

Contents


Module Procedures

private pure function quat_init_array(x) result(rst)

Constructs a quaternion from a 4-element array stored such that [w, x, y, z].

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in), dimension(4) :: x

The array from which to initialize the quaternion stored in the order [w, x, y, z].

Return Value type(quaternion)

The resulting quaternion.

private pure function quat_init_angle_axis(angle, axis) result(rst)

Constructs a quaternion given an axis and the angle of rotation about the axis.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: angle

The rotation angle, in radians.

real(kind=real64), intent(in), dimension(3) :: axis

A 3-element vector defining the axis about which the rotation occurrs.

Return Value type(quaternion)

The resulting quaternion.

private pure function quat_init_mtx(r) result(rst)

Constructs a quaternion from a 3-by-3 rotation matrix using the Stanley method.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in), dimension(3, 3) :: r

The rotation matrix.

Return Value type(quaternion)

The resulting quaternion.